package com.haonan.springboot_exercise.bean;

import lombok.Data;

import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;

/**
 * 单个邮件（to是String）
 * @author haonan
 * @date 2021/4/14 21:51
 **/
@Data
public class Email {
    private Integer email_id;

    private String from;

    private String to;

    private String sent_time;

    private String subject;

    private String text;

    public Email(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        this.sent_time = simpleDateFormat.format(new Date());
    }

    public Email(String from, String to, String sentDate, String subject, String text) {
        this.from = from;
        this.to = to;
        this.sent_time = sentDate;
        this.subject = subject;
        this.text = text;
    }

    @Override
    public String toString(){
        return "email_id=" + this.email_id + "; " +
                "from=" + this.from + "; " +
                "to=" + this.to + "; " +
                "sentDate=" + this.sent_time + "; " +
                "subject=" + this.subject + "; " +
                "text=" + this.text;
    }
}
